package com.c2soft.ncmxSocket;

import java.io.File;
import java.io.IOException;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;

public class ReadMcxContract {
	public static void main(String[] args) throws IOException {

		Map<String, String> tokenIdSymbolMap = readMCXContract();

		System.out.println(tokenIdSymbolMap);
	}

	private static Map<String, String> readMCXContract() throws IOException {
		File file = new File("MCX.txt");
		Map<String, String> tokenIdSymbolMap = new IdentityHashMap<String, String>();
		// String string = FileUtils.readFileToString(file);
		List<String> lines = FileUtils.readLines(file);
		for (String line : lines) {
			if (StringUtils.isNotBlank(line)) {
				//System.out.println("line:" + line);
				String[] strArray = StringUtils.split(line, ",");
				tokenIdSymbolMap.put(strArray[1], strArray[2]);
			}
		}
		
		return tokenIdSymbolMap;

	}
}
